/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page, TreeDataModel } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface ShopProductClsInv extends BasicModel<ShopProductClsInv> {
  clsCode?: string; // 系列编码
  invCode?: string; // 存货编码
}

export const shopProductClsInvList = (params?: ShopProductClsInv | any) =>
  defHttp.get<ShopProductClsInv>({
    url: adminPath + '/shop/product/shopProductClsInv/list',
    params,
  });

export const shopProductClsInvListData = (params?: ShopProductClsInv | any) =>
  defHttp.post<Page<ShopProductClsInv>>({
    url: adminPath + '/shop/product/shopProductClsInv/listData',
    params,
  });

export const shopProductClsInvForm = (params?: ShopProductClsInv | any) =>
  defHttp.get<ShopProductClsInv>({
    url: adminPath + '/shop/product/shopProductClsInv/form',
    params,
  });

export const shopProductClsInvSave = (params?: any, data?: ShopProductClsInv | any) =>
  defHttp.postJson<ShopProductClsInv>({
    url: adminPath + '/shop/product/shopProductClsInv/save',
    params,
    data,
  });

export const shopProductClsInvImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/shop/product/shopProductClsInv/importData',
      onUploadProgress,
    },
    params,
  );

export const shopProductClsInvDelete = (params?: ShopProductClsInv | any) =>
  defHttp.get<ShopProductClsInv>({
    url: adminPath + '/shop/product/shopProductClsInv/delete',
    params,
  });

export const shopProductClsInvTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({
    url: adminPath + '/shop/product/shopProductCls/treeData',
    params,
  });

export const batchSaveInv = (params?: any, data?: ShopProductClsInv | any) =>
  defHttp.postJson<ShopProductClsInv>({
    url: adminPath + '/shop/product/shopProductClsInv/batchSaveInv',
    params,
    data,
  });

export const cancelInv = (params?: any, data?: ShopProductClsInv | any) =>
  defHttp.postJson<ShopProductClsInv>({
    url: adminPath + '/shop/product/shopProductClsInv/cancelInv',
    params,
    data,
  });
